package com.lbs.jiepiaisi.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.lbs.jiepiaisi.R;
import com.lbs.jiepiaisi.adapter.NewsViewPagerAdapter;
import com.lbs.jiepiaisi.base.BaseActivity;
import com.lbs.jiepiaisi.base.BaseFragmentActivity;

public class NewsMoreActivity extends BaseFragmentActivity implements View.OnClickListener {
    private NewsViewPagerAdapter mNewsViewPagerAdapter;
    private ViewPager mViewPager;
    private TabLayout mTabLayout;

    private ImageButton mTitleBack;

    @Override
    protected void setView() {
        super.setView();
        setContentView(R.layout.activity_news_more);
    }

    @Override
    protected void getExtras() {

    }

    @Override
    protected void findView() {
        mViewPager = (ViewPager) findViewById(R.id.vp_viewpager);
        mTabLayout = (TabLayout) findViewById(R.id.tl_tabs);
        mTitleBack = (ImageButton) findViewById(R.id.title_but_left);

        mNewsViewPagerAdapter = new NewsViewPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(mNewsViewPagerAdapter);
        //Viewpager和Tablayout进行关联
        mTabLayout.setupWithViewPager(mViewPager);
        //用于多TAB，Tablayout可以滚动
        mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
    }

    @Override
    protected void setListener() {
        mTitleBack.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.title_but_left:
                finish();
                break;
        }
    }
}
